
<template>
    <div>
        <van-nav-bar left-arrow @click-left="back" />
        <div class="shopxxqq">
            <van-swipe :autoplay="3000">
                <van-swipe-item v-for="image in detdata.imgs" :key="imgs">
                    <img :src="image" style="width: 100%;height: 400px;" />
                </van-swipe-item>
            </van-swipe>
            <h3>
                {{ detdata.title }}
            </h3>
            <p class="qian">￥{{ detdata.price }}</p>
        </div>
        <footer>
            <van-action-bar>
                <van-action-bar-icon icon="chat-o" text="客服" dot />
                <van-action-bar-icon icon="cart-o" text="购物车" />
                <van-action-bar-icon icon="shop-o" text="店铺" />
                <van-action-bar-button type="warning" text="加入购物车" />
                <van-action-bar-button type="danger" text="立即购买" />
            </van-action-bar>
        </footer>
    </div>
</template>

<script lang="ts" setup>
// import "./index.css"
import { ref, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import axios from 'axios';
const route = useRoute()
const router = useRouter()
const id = route.query.id

const detdata = ref({})

const getDetail = async () => {
    await axios.get('/api/shop',{params:{id:id}}).then(res=>{
  console.log(res.data.data);
  detdata.value=res.data.data
  console.log(detdata.value.title);
  
})
}
getDetail()

const back = () => {
    router.push('/shop');
}
</script>

<style lang="scss" scoped>
.qian {
    width: 50px;
    height: 50px;
    font-size: 50px;
    color: brown;
}

.shopxxqq {
    padding: 20px;
}
</style>